package class_and_object.china;

public class ClassTest {
    public static void main(String[] args) {
        Person person=new Person();
        person.name="chen";
        person.age=18;

        person.eat("rice");
        person.show();

        China china1=new China();
        china1.name="雷昊";
        china1.age=20;
        china1.country="中国";

        China china2=new China();
        china2.name="蔡某文";
        china2.age=60;

        china1.show();
        china2.show();
    }

}

class Person{
    //包访问 default
    //只有同包可访问
    public String name;
    public int age;

    public void eat(String food){
        System.out.println(name+" is eating "+food);
    }

    public void show(){
        System.out.println(name+" is "+age);
    }
}

class China{
    public String name;
    public int age;
    public static String country;

    public void show(){
        System.out.println(name+"今年"+age+"来自"+country);
    }
}
